# coding:utf-8

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# generate_password_hash 生成加密的密码
# check_password_hash  验证
# from werkzeug.security import generate_password_hash,check_password_hash

app = Flask(__name__)
app.debug = True

db = SQLAlchemy()

# 密钥
# 交互模式
# import os
# os.urandom(20)
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
def create_app():
    app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:123456@127.0.0.1:3306/project_1'
    db.init_app(app)

    # 3.在这里导入，然后注册到app
    # 从同级目录里面找到main文件夹
    from .main import main
    app.register_blueprint(main)

    from .auth import auth
    app.register_blueprint(auth)


    return app